function handles = ben_importYfracData(handles)
% BEN_IMPORTYFRACDATA
%
% Reads from a structure called 'ben_distanceData' in the workspace, which
% you should have previously generated using the ben_measureDistances
% userfunction from a picture of the slice and pipette at 4x. 
%
% Ben Suter 2009-10-09 -- Based on importYfracData from GS
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

distanceData = evalin('base', 'ben_distanceData');

% update gui values
set(handles.fieldAName, 'String', 'corticalThickness');
set(handles.fieldBName, 'String', 'fracSoma');
set(handles.fieldCName, 'String', 'fracL1L2');
set(handles.fieldDName, 'String', 'fracL3L5a');
set(handles.fieldEName, 'String', 'fracL5aL5b');
set(handles.fieldFName, 'String', 'angleFromVertical');
set(handles.fieldGName, 'String', 'somaPosition');

set(handles.fieldAVal, 'String', num2str(round(distanceData.corticalThickness)));
set(handles.fieldBVal, 'String', num2str(distanceData.fracSoma));
set(handles.fieldCVal, 'String', num2str(distanceData.fracL1L2));
set(handles.fieldDVal, 'String', num2str(distanceData.fracL3L5a));
set(handles.fieldEVal, 'String', num2str(distanceData.fracL5aL5b));
set(handles.fieldFVal, 'String', num2str(round(distanceData.angleFromVertical)));
set(handles.fieldGVal, 'String', sprintf('%g%g', distanceData.somaPosition));

% update handles variable
handles.data.analysis.fieldAName = 'corticalThickness';
handles.data.analysis.fieldAVal = distanceData.corticalThickness;
handles.data.analysis.fieldBName = 'fracSoma';
handles.data.analysis.fieldBVal = distanceData.fracSoma;
handles.data.analysis.fieldCName = 'fracL1L2';
handles.data.analysis.fieldCVal = distanceData.fracL1L2;
handles.data.analysis.fieldDName = 'fracL3L5a';
handles.data.analysis.fieldDVal = distanceData.fracL3L5a;
handles.data.analysis.fieldEName = 'fracL5aL5b';
handles.data.analysis.fieldEVal = distanceData.fracL5aL5b;
handles.data.analysis.fieldFName = 'angleFromVertical';
handles.data.analysis.fieldFVal = distanceData.angleFromVertical;
handles.data.analysis.fieldGName = 'somaPosition';
handles.data.analysis.fieldGVal = distanceData.somaPosition;
